package com.atom.plugin.aap

import com.atom.plugin.core.CorePlugin
import org.apache.commons.io.IOUtils
import org.objectweb.asm.ClassReader
import java.io.File
import java.io.InputStream

class AapCorePlugin : CorePlugin<AapExtension>() {

    val GENERATE_TO_CLASS_NAME = "com/atom/module/core/aap/AapEngine"
    val GENERATE_TO_CLASS_FILE_NAME = "$GENERATE_TO_CLASS_NAME.class"
    val GENERATE_TO_METHOD_NAME = "loadProxyClass"
    val ROUTER_CLASS_PACKAGE_NAME = "com\\atom\\apt\\proxy"
    val REGISTER_METHOD_NAME = "registerClass"

    val scanningResultList = mutableListOf<String>()
    var scanningInsertResultFileClass: File? = null

    override fun getExtensionName(): String {
        return this.javaClass.simpleName
    }

    override fun getExtensionClass(): Class<AapExtension> {
        return AapExtension::class.java
    }


    override fun collectClassStream(inputStream: InputStream, isFromJar: Boolean) {
        val reader = ClassReader(inputStream)

    }

    override fun transformClassStream(inputStream: InputStream): ByteArray {
        return IOUtils.toByteArray(inputStream)
    }

}